<!doctype html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>SDLPal</title>
    <style>
      body {
        font-family: arial;
        margin: 0;
        padding: none;
      }

      .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
      div.emscripten { text-align: center; }      
      div.emscripten_border { border: 1px solid black; }
      /* the canvas *must not* have any border or padding, or mouse coords will be wrong */
      canvas.emscripten { border: 0px none; background-color: black; }

      #emscripten_logo {
        display: inline-block;
        margin: 0;
      }

      .spinner {
        height: 30px;
        width: 30px;
        margin: 0;
        margin-top: 20px;
        margin-left: 20px;
        display: inline-block;
        vertical-align: top;

        -webkit-animation: rotation .8s linear infinite;
        -moz-animation: rotation .8s linear infinite;
        -o-animation: rotation .8s linear infinite;
        animation: rotation 0.8s linear infinite;

        border-left: 5px solid rgb(235, 235, 235);
        border-right: 5px solid rgb(235, 235, 235);
        border-bottom: 5px solid rgb(235, 235, 235);
        border-top: 5px solid rgb(120, 120, 120);
        
        border-radius: 100%;
        background-color: rgb(189, 215, 46);
      }

      .footer {
        position: fixed;
        left: 0px;
        bottom: 0px;
        width: 100%;
        height: 50px;
        z-index: 9999;
        text-align: center;
      }

      @-webkit-keyframes rotation {
        from {-webkit-transform: rotate(0deg);}
        to {-webkit-transform: rotate(360deg);}
      }
      @-moz-keyframes rotation {
        from {-moz-transform: rotate(0deg);}
        to {-moz-transform: rotate(360deg);}
      }
      @-o-keyframes rotation {
        from {-o-transform: rotate(0deg);}
        to {-o-transform: rotate(360deg);}
      }
      @keyframes rotation {
        from {transform: rotate(0deg);}
        to {transform: rotate(360deg);}
      }

      #status {
        display: inline-block;
        vertical-align: top;
        margin-top: 30px;
        margin-left: 20px;
        font-weight: bold;
        color: rgb(120, 120, 120);
      }

      #progress {
        height: 20px;
        width: 300px;
      }

      #controls {
        display: inline-block;
        float: right;
        vertical-align: top;
        margin-top: 30px;
        margin-right: 20px;
      }

      input[type=file] {
        color: transparent;
        font-size: 12pt;
      }

      input[type=file]::-webkit-file-upload-button {
        margin: 0px;
        font-size: 12pt;
        padding: 4px;
        border: solid 1px #AACFE4;
        width: 209px;
        height: 31px;
        border-radius: 5px;
        box-shadow: 0px 0px 10px #ccc;
      }

      button,#btnLaunch,#btnDeleteData,#btnDownloadSave {
        margin: 0px;
        font-size: 12pt;
        padding: 4px;
        border: solid 1px #AACFE4;
        width: 209px;
        border-radius: 5px;
        box-shadow: 0px 0px 10px #ccc;
      }

    </style>
  </head>
  <body>
    <a href="http://sdlpal.github.io/">
      <img src="icon.png"></img>
    </a>

    <div class="spinner" id='spinner'></div>
    <div class="emscripten" id="status"></div>

    <span id='controls'>
      <span>
        <input type="file" id="btnLoadZip" accept="application/zip" value="Load Zip" onchange="loadZip();">
        <input type="button" id="btnDeleteData" value="Delete Data" onclick="clearData();">
        <input type="button" id="btnDownloadSave" value="Download Saved Games" onclick="downloadSaves();">
        <input type="button" id="btnLaunch" value="Launch" onclick="launch();">
      </span>
    </span>

    <div class="emscripten">
      <progress value="0" max="100" id="progress" hidden=1></progress>
    </div>

    <div class="emscripten_border">
      <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
    </div>

    <script type="text/javascript" src="jszip.min.js"></script>
    <script type="text/javascript" src="main.js"></script>
    <script type="text/javascript" src="sdlpal.js"></script>

    <script type="text/javascript">
        var userLang = navigator.language || navigator.userLanguage;
        if (userLang === 'zh-CN' || userLang.startsWith('zh-Hans')) {
            document.getElementById('btnDeleteData').value = '删除游戏数据';
            document.getElementById('btnDownloadSave').value = '下载存档';
            document.getElementById('btnLaunch').value = '开始游戏';
        } else if (userLang === 'zh-TW' || userLang.startsWith('zh-Hant')) {
            document.getElementById('btnDeleteData').value = '刪除遊戲資料';
            document.getElementById('btnDownloadSave').value = '下載記錄';
            document.getElßementById('btnLaunch').value = '開始遊戲';
        }
    </script>
    <div id="tips" class="footer">注意事项</div>
  </body>
</html>
